#ifndef _TRANSPO_H_
#define _TRANSPO_H_

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "../spanishFreq.h"
#include "dataProcessing.h"

#define MAX_KEY_LENGTH 10
#define MIN_KEY_LENGTH 2


typedef struct transColum
{
	int * elem;
	int size;
} transColum;

/**
 * Decrypts the transposition encrypted text.
 *
 * @param[in]	s		    The encrypted text.
 * @param[in]	size	    The length of the encrypted text.
 *
 * @return	-.
 */
void solveTranspo(int *s, long size);

/**
 * Checks if the given alphabetArray was cyphered with the Transposition method
 * by comparing it to the one alphabetArray corresponding to the selected
 * language.
 *
 * @param[in]	sortedCypherFreq	The sorted frequencies of the cyephered text.
 * @param[in]	cypherFreq        The frequencies of the language.
 * @param[in]	top	            The top number of characters that will be checked.
 * @param[in]	tole              The tolerance of the comparation between 2 frequencies.
 *                               0 <= tole <=100.
 *
 * @warning both alphabetArray must be sorted by frequency.
 *
 * @return	Lower than zero in case of error, zero if the cyphering method used
 *          wasn't transposition. Greater than zero if the method was
 *          transposition.
 */
int checkTransposition (alphabetArray cypherFreq, alphabetArray sortedLangFreq,
      int top, float tole);
#endif
